package com.qf.springbootdemo02.config;

import springfox.documentation.service.Contact;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.StringVendorExtension;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author q
 * @version V1.0
 * @date 2021/11/22
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket docket(){
        Contact contact = new Contact("contact_hsr", "http://gitee.com", "872608432@qq.com");
        Collection<VendorExtension> collection = new ArrayList<>();
        collection.add(new StringVendorExtension("aa", "AA"));
        collection.add(new StringVendorExtension("bb", "BB"));
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("java2106")   //组名
                //自定义信息
                .apiInfo(new ApiInfo("myTitle", "myDescription...", "version_1.0", "http://www.baidu.com",
                        contact, "license许可证", "http://qfedu.com/", collection));
    }

}
